
#include "stdafx.h"
#include "imagectrlbox.h"

ImageCtrlBox::ImageCtrlBox(void)
	: m_posy(0)
{
}

ImageCtrlBox::~ImageCtrlBox(void)
{
	UnLoad();
}

void ImageCtrlBox::Load()
{
}

void ImageCtrlBox::UnLoad()
{
	m_imagectrls.clear();
}

void ImageCtrlBox::SetRect(const RECT& rect)
{
	m_rect = rect;

	Layout();
}

RECT ImageCtrlBox::GetRect()
{
	return m_rect;
}

void ImageCtrlBox::Draw(HDC dc)
{
	for (std::list<ImageCtrl*>::iterator it = m_imagectrls.begin(); it != m_imagectrls.end(); ++it)
	{
		ImageCtrl* imagectrl = *it;
		if (imagectrl != NULL)
			imagectrl->Draw(dc);
	}
}

bool ImageCtrlBox::MouseMove(const POINT& point)
{
	for (std::list<ImageCtrl*>::iterator it = m_imagectrls.begin(); it != m_imagectrls.end(); ++it)
	{
		ImageCtrl* imagectrl = *it;
		if (imagectrl != NULL)
		{
			imagectrl->MouseMove(point);
		}
	}

	return false;
}

bool ImageCtrlBox::MouseDown(const POINT& point)
{
	for (std::list<ImageCtrl*>::iterator it = m_imagectrls.begin(); it != m_imagectrls.end(); ++it)
	{
		ImageCtrl* imagectrl = *it;
		if (imagectrl != NULL)
		{
			if (imagectrl->MouseDown(point))
				return true;
		}
	}

	return false;
}

bool ImageCtrlBox::MouseUp(const POINT& point)
{
	for (std::list<ImageCtrl*>::iterator it = m_imagectrls.begin(); it != m_imagectrls.end(); ++it)
	{
		ImageCtrl* imagectrl = *it;
		if (imagectrl != NULL)
		{
			if (imagectrl->MouseUp(point))
				return true;
		}
	}

	return false;
}

long ImageCtrlBox::GetContentHeight()
{
	return 0;
}

void ImageCtrlBox::ScrollTo(long posy)
{
	m_posy = posy;
	Layout();
}

void ImageCtrlBox::Layout()
{
}
